package com.ambition.mallchat.common.user.service.adapter;

import com.ambition.mallchat.common.user.domain.entity.User;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;

/**
 * @program: mallchat-learnning
 * @ClassName UserAdapter
 * @description:
 * @author: oldTea
 * @create: 2023-10-28 09:46
 * @Version 1.0
 **/
public class UserAdapter {


    public static User buildUserSave(String openId) {
        User build = User.builder().openId(openId).build();
        return build;
    }

    public static User authorizeUser(Long id, WxOAuth2UserInfo userInfo) {
        User user = new User();
        user.setId(id);
        user.setAvatar(userInfo.getHeadImgUrl());
        user.setName(userInfo.getNickname());
        return user;
    }
}